import React, { Component } from 'react'

import Dialog from './Dialog'

export default class App extends Component {
  constructor(props){
    super(props)
    this.state = {
      diaShow: false
    }
  }
  showDialog() {
    this.setState({
      diaShow: true
    })
  }
  closeDialog() {
    this.setState({
      diaShow: false
    })
  }
  render() {
    let { diaShow } = this.state
    return (
      <div>
        <h1>弹出框示例</h1>
        <button onClick={()=>this.showDialog()}>点击弹出对话框</button>
        <Dialog 
          show={ diaShow }
          close={ ()=>this.closeDialog() }/>
      </div>
    )
  }
}
